home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / bin / DXUtils / AppWizard / DXAppwiz.awx / TEMPLATE / DMUTIL.H < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-25  |  4.2 KB  |  125 lines

  1. //-----------------------------------------------------------------------------
  2. // File: DMUtil.h
  3. //
  4. // Desc: 
  5. //-----------------------------------------------------------------------------
  6. #ifndef DMUTIL_H
  7. #define DMUTIL_H
  8.  
  9. #include <dmusicc.h>
  10. #include <dmusici.h>
  11. #include <dsound.h>
  12.  
  13.  
  14. //-----------------------------------------------------------------------------
  15. // Classes used by this header
  16. //-----------------------------------------------------------------------------
  17. class CMusicManager;
  18. class CMusicSegment;
  19. class CMusicScript;
  20.  
  21.  
  22.  
  23.  
  24. //-----------------------------------------------------------------------------
  25. // Name: class CMusicManager
  26. // Desc: 
  27. //-----------------------------------------------------------------------------
  28. class CMusicManager
  29. {
  30. protected:
  31.     BOOL                      m_bCleanupCOM;
  32.     IDirectMusicLoader8*      m_pLoader;
  33.     IDirectMusicPerformance8* m_pPerformance;
  34.  
  35. public:
  36.     CMusicManager();
  37.     ~CMusicManager();
  38.  
  39.     inline IDirectMusicLoader8*      GetLoader()      { return m_pLoader; }
  40.     inline IDirectMusicPerformance8* GetPerformance() { return m_pPerformance; }
  41.     IDirectMusicAudioPath8* GetDefaultAudioPath();
  42.  
  43.     HRESULT Initialize( HWND hWnd, DWORD dwPChannels = 128, DWORD dwDefaultPathType = DMUS_APATH_DYNAMIC_STEREO );
  44.  
  45.     HRESULT SetSearchDirectory( const TCHAR* strMediaPath );
  46.     VOID    CollectGarbage();
  47.  
  48.     HRESULT CreateSegmentFromFile( CMusicSegment** ppSegment, TCHAR* strFileName, 
  49.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  50.     HRESULT CreateScriptFromFile( CMusicScript** ppScript, TCHAR* strFileName );
  51.  
  52.     HRESULT CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap, TCHAR* strFileName );
  53.     HRESULT CreateStyleFromFile( IDirectMusicStyle8** ppStyle, TCHAR* strFileName );
  54.     HRESULT GetMotifFromStyle( IDirectMusicSegment8** ppMotif, TCHAR* strStyle, TCHAR* wstrMotif );
  55.  
  56.     HRESULT CreateSegmentFromResource( CMusicSegment** ppSegment, TCHAR* strResource, TCHAR* strResourceType, 
  57.                                    BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
  58. };
  59.  
  60.  
  61.  
  62.  
  63. //-----------------------------------------------------------------------------
  64. // Name: class CMusicSegment
  65. // Desc: Encapsulates functionality of an IDirectMusicSegment
  66. //-----------------------------------------------------------------------------
  67. class CMusicSegment
  68. {
  69. protected:
  70.     IDirectMusicSegment8*     m_pSegment;
  71.     IDirectMusicLoader8*      m_pLoader;
  72.     IDirectMusicPerformance8* m_pPerformance;
  73.     IDirectMusicAudioPath8*   m_pEmbeddedAudioPath;
  74.     BOOL                      m_bDownloaded;
  75.  
  76. public:
  77.     CMusicSegment( IDirectMusicPerformance8* pPerformance, 
  78.                    IDirectMusicLoader8* pLoader,
  79.                    IDirectMusicSegment8* pSegment );
  80.     virtual ~CMusicSegment();
  81.  
  82.     inline  IDirectMusicSegment8* GetSegment() { return m_pSegment; }
  83.     HRESULT GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex = 0 );
  84.  
  85.     HRESULT SetRepeats( DWORD dwRepeats );
  86.     HRESULT Play( DWORD dwFlags = DMUS_SEGF_SECONDARY, IDirectMusicAudioPath8* pAudioPath = NULL );
  87.     HRESULT Stop( DWORD dwFlags = 0 );
  88.     HRESULT Download( IDirectMusicAudioPath8* pAudioPath = NULL );
  89.     HRESULT Unload( IDirectMusicAudioPath8* pAudioPath = NULL );
  90.  
  91.     BOOL    IsPlaying();
  92. };
  93.  
  94.  
  95.  
  96.  
  97. //-----------------------------------------------------------------------------
  98. // Name: class CMusicScript
  99. // Desc: Encapsulates functionality of an IDirectMusicScript
  100. //-----------------------------------------------------------------------------
  101. class CMusicScript
  102. {
  103. protected:
  104.     IDirectMusicScript8*      m_pScript;
  105.     IDirectMusicLoader8*      m_pLoader;
  106.     IDirectMusicPerformance8* m_pPerformance;
  107.  
  108. public:
  109.     CMusicScript( IDirectMusicPerformance8* pPerformance, 
  110.                   IDirectMusicLoader8* pLoader,
  111.                   IDirectMusicScript8* pScript );
  112.     virtual ~CMusicScript();
  113.  
  114.     inline  IDirectMusicScript8* GetScript() { return m_pScript; }
  115.  
  116.     HRESULT CallRoutine( TCHAR* strRoutine );
  117.     HRESULT SetVariableNumber( TCHAR* strVariable, LONG lValue );
  118.     HRESULT GetVariableNumber( TCHAR* strVariable, LONG* plValue );
  119. };
  120.  
  121.  
  122.  
  123.  
  124. #endif // DMUTIL_H
  125.